package cn.varton;

/**
 * 归属地查询
 */
public class BelongQuery implements IBelong {

    @Override
    public void queryBelong(String param) {
        if (param.matches("^(1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|[1-9])\\.(1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|\\d)\\.(1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|\\d)\\.(1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|\\d)$")){
            new IpBelong().queryBelong(param);
        }else if (param.matches("^(010-\\d{8}|02\\d-\\d{8}|0[3-9]\\d{2}-\\d{8})$")){
            new FixedLineBelong().queryBelong(param);
        }else if (param.matches("[1-7]\\d{6,11}|8[0-357-9]\\d{6,9}|9\\d{7,9}")){
            new MobileBelong().queryBelong(param);
        }else {
            System.out.println("参数不合法！");
        }
    }
}
